<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('律师信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>律师：</label>
<!--                            <input type="text" name="userId"/>-->
                            <div class="col-sm-8">
                                <select name="userId" class="form-control m-b" th:with="userList=${userList}">
                                    <option value="">所有</option>
                                    <option th:each="user : ${userList}" th:text="${user.userName}" th:value="${user.userId}"></option>
                                </select>
                            </div>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="business:lawyerInfo:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:lawyerInfo:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:lawyerInfo:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:lawyerInfo:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('business:lawyerInfo:edit')}]];
    var removeFlag = [[${@permission.hasPermi('business:lawyerInfo:remove')}]];
    var userList = [[${userList}]];

    var prefix = ctx + "business/lawyerInfo";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "律师信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'lawyerId',
                    title: '律师id',
                    visible: false
                },
                {
                    field: 'lawyerName',
                    title: '律师姓名'
                },
                {
                    field: 'userId',
                    title: '律师',
                    formatter: function(value, row, index) {
                        var datas = userList;
                        if ($.common.isEmpty(datas) || $.common.isEmpty(value)) {
                            return '';
                        }
                        var actions = [];
                        $.each(datas, function(indexs, dict) {
                            if (dict.userId == ('' + value)) {
                                var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass;
                                actions.push($.common.sprintf("<span class='%s'>%s</span>", listClass, dict.userName));
                                return false;
                            }
                        });
                        return actions.join('');
                    },
                    visible: false
                },
                {
                    field: 'lawyerCertificateNo',
                    title: '律师执业证件号'
                },
                {
                    field: 'address',
                    title: '地址'
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'email',
                    title: '邮箱'
                },
                {
                    field: 'lawFirmName',
                    title: '所在律师事务所名称'
                },
                {
                    field: 'lawyerIntroduce',
                    title: '律师介绍'
                },
                {
                    field: 'label',
                    title: '标签'
                },
                {
                    field: 'price',
                    title: '金点子服务价格'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.lawyerId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.lawyerId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>